﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using SYcwpb.ViewModels;
using MessageBox = System.Windows.MessageBox;

namespace SYcwpb.Views
{
    /// <summary>
    /// MonthPlaneDate.xaml 的交互逻辑
    /// </summary>
    public partial class MonthPlaneDate : Window
    {
        private DriverTeamViewModel _viewMode;
        public MonthPlaneDate()
        {
            InitializeComponent();
        }

        public MonthPlaneDate(DriverTeamViewModel ss)
        {
            this._viewMode = ss;
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {  
            this.DataContext = _viewMode;
            _viewMode.SetEndDate();

            _viewMode.isOk = false;
            
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            if (dpStartDay.SelectedDate == null || dpEndDay.SelectedDate == null)
            {
                MessageBox.Show("请选择起止时间!");
                return;
            }
            if (dpStartDay.SelectedDate > dpEndDay.SelectedDate)
            {
                MessageBox.Show("起始时间必须大于结束时间!");
                return;
            }
           
            MessageBoxResult msr = SYcwpb.Helpers.MessageBoxHelper.ShowYesNoAndTips("请确认是否已经在人员调整页面选择了派班日期");
            if (msr != MessageBoxResult.Yes)
            {
                return;
            }


            _viewMode.isOk = true;
            this.Close();
        }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            _viewMode.isOk = false;
            this.Close();
        }
    }
}
